package com.net.xpay.core.domain;

import com.net.xpay.common.domain.User;
import com.net.common.domain.VersionedDomain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * @author  on 22/02/2018.
 * 用户的账户,支付相关的逻辑对象,钱都是分为单位的,金币和钱的单位完全一致的
 * id非自增, id = user.Id
 */
@Getter
@Setter
@NoArgsConstructor
public class UserAccount extends VersionedDomain {
    @ApiModelProperty(notes = "剩余的money 单位分")
    private Long moneyLeft;

    @ApiModelProperty(notes = "免费转账批次数量 单位次")
    private Long transBatchLeft;

    public static UserAccount getInstance(User user) {
        UserAccount account = new UserAccount();
        account.setId(user.getId());
        account.setMoneyLeft(0L);
        account.setTransBatchLeft(0L);
        return account;
    }

}
